//
//  GoogleHealth.h
//  iHealthEHR
//
//  Created by Joseph Ayo Akinyele on 3/11/10.
//  Copyright 2010 Johns Hopkins University. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "GDataHealth.h"

@protocol GHMethods<NSObject>
// may flush out retrieval for profileListFeeds, profileFeeds and registerFeeds. However
// those interfaces will need data associated with them.
// TODO: may add some metadata to the successful calls in the protocol.

-(void) loginSuccessfulandFeedsSet;
-(void) loginFailed:(NSError *) error stage:(NSString *) message;
-(void) uploadSuccessful;
-(void) uploadFailed:(NSError *) error stage:(NSString *) message;
@end


@interface GoogleHealth : NSObject {
    Class mServiceClass;
	NSString *gUsername, *gPassword;
	NSString *profileName, *profileID;
	
	/* Array of profile entries: GDataEntryBase */
	// NSMutableArray *arrayEntries;
	
	/* retrieve profile list of feeds */
	GDataFeedBase *mProfileListFeed;
	GDataFeedHealthProfile *mProfileFeed;
	GDataFeedHealthRegister *mRegisterFeed;
	
	/* BOOL */
	BOOL isRegisterFeedPending;
@private /* cannot be accessed directly */
	id<GHMethods> callerDelegate;
	SEL callerFunction;
}

@property (nonatomic, retain) GDataFeedBase *mProfileListFeed;
@property (nonatomic, retain) GDataFeedHealthProfile *mProfileFeed;
@property (nonatomic, retain) GDataFeedHealthRegister *mRegisterFeed;
@property (nonatomic, retain) NSString *gUsername, *gPassword;
@property (nonatomic, retain) NSString *profileName, *profileID;

@property BOOL isRegisterFeedPending;
@property (nonatomic, retain) Class mServiceClass;

-(void) useGoogleHealthProduction:(BOOL) option;
/* connect to google health */
- (GDataServiceGoogleHealth *)healthService;
-(GDataEntryBase *) selectProfile:(NSString *) name;
-(NSURL *)getFeedURL;
-(void)fetchMyFeeds:(NSString *) profile withDelegate:(id) delegate andCallback:(SEL) function;
-(void) sendUpdate:(GDataContinuityOfCareRecord *) ccrEntry withDelegate:(id) delegate andCallback:(SEL) function;
-(void) sendNotice:(NSString *) noticeTitle withContent:(NSString *) contentHtml;
@end
